package com.lzw.controller.student;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzw.pojo.Building;
import com.lzw.service.student.SBuildingS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin(origins = "http://localhost:7070")
@RestController
@RequestMapping("/SBC")
public class SBuildingC {

    @Autowired
    private SBuildingS sBuildingS;

    @GetMapping("/list")
    public PageInfo<Building> list(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            String name){
        PageHelper.startPage(pageNum,pageSize);
        List<Building> list = sBuildingS.list(pageNum,pageSize,name);
        return new PageInfo<>(list);
    }
}
